package com.chinasofti.map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo03 {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();

        //put(K key , V value)
        map.put("K1","V1");
        map.put("K2","V2");
        map.put("K3","V3");
        map.put("K4","V4");
        map.put("K5","V5");

        //V get (Object key)
        //System.out.println(map.get("K1"));
       //System.out.println(map.get("K2"));
        //method1(map);
        //method2(map)+;
    }

    private static void method2(Map<String, String> map) {
        //Collection<V》 values 0
        Collection<String> values = map.values();
        for (String v :values){
            System.out.println("v = " + v);
        }
    }

    private static void method1(Map<String, String> map) {
        // Set<K> keySet()
        Set<String> keySet = map.keySet();
        for (String key:keySet){
            System.out.println(key + "," + map.get(key));
        }
    }
}
